home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
7_10.lha
/
7_10
/
qh_putback.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
1KB
|
45 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
include <process.h>
include <debug.h> /* DELETE */
/ Insert object at the beginning of the process_queue.
/ It is an error if there is no room.
nt queue_head::unget(process_object *p)
if (debug) /*DELETE*/ cerr << "queue_head" << this << "::unget()\n";
process_queue *q = qh_queue;
if (p->po_next)
error("queue_head::unget(): object on another queue");
if (q->q_count >= q->q_max)
switch (qh_mode)
{
case Q_WMODE:
case Q_EMODE:
error("queue_tail::unget(): full queue");
/* FALLTHROUGH */
case Q_ZMODE:
if (debug) /*DELETE*/ cerr << "<<<< queue_head" << this << "::unget() <- 0\n";
return 0;
}
// new object on empty queue
if (q->q_count++ == 0)
q->q_last = p->po_next = p;
// objects are already on the queue
else
{
process_object *last = q->q_last;
p->po_next = last->po_next;
last->po_next = p;
}
if (debug) /*DELETE*/ cerr << "<<<< queue_head" << this << "::unget() <- 1\n";
return 1;